<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>用户部门分配</title>
		 <link rel="stylesheet" href="__PUBLIC__/frame/layui/css/layui.css">
		<!--<link rel="stylesheet" href="http://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css">-->
		<link rel="stylesheet" href="__PUBLIC__/frame/static/css/style.css">
	</head>
	<body>
		<!-- <a href="<?php echo U('Service/lst');?>" class="layui-btn" style="margin-top: 10px; "><i class="layui-icon">&#xe603;</i>客户列表</a>
		<a class="layui-btn btn-add btn-default" id="btn-refresh" style="margin-top: 10px;"><i class="layui-icon">&#x1002;</i></a> -->
		<form class="layui-form">
			</br>
			<div class="layui-form-item">
			<label class="layui-form-label">公司部门</label>
				<div class="layui-input-block">
				<input type="hidden" name="id" value="{$id}" />
				<?php foreach ($part as $k => $v):?>
					<input type="radio" name="part_id" value="{$v['id']}" title="{$v['name']}">
				<?php endforeach;?>
				</div>
			</div>
			
 									
			<div class="layui-form-item" style="margin-top: 10px;">
				    <div class="layui-input-block">
				      <button id="sub" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
				      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
				    </div>
			</div>
			
		</form>
		
	</body>
    <script type="text/javascript" src="__PUBLIC__/frame/layui/layui.js"></script>
	<script>
	layui.use(['form', 'jquery','layer','layedit', 'laydate'], function(){
	  var form = layui.form
	  ,   	$= layui.jquery
	  ,layer = layui.layer
	  ,layedit = layui.layedit
	  ,laydate = layui.laydate;		
	  //刷新按钮 
	  $('#btn-refresh').on('click', function () {
            location.reload();
      });
      //获取窗口索引
      var index = parent.layer.getFrameIndex(window.name);
      //分配
      $('#sub').click(function(){
      	var id = $("input[name=id]").val();
      	var part = $("input[type=radio]:checked").val();
      	if(part==''){
      		layer.msg('请选着部门！');
      		return false;
      	}
      	$.post('/index.php/Hawk/Admin/allot',{'id':id,'part':part},function(data){
      		// console.log(data);return false;
      		var obj = eval('(' + data + ')');
	    	if(obj.code==1){
	    		parent.layer.close(index);
	    		alert(obj.msg);
	    		parent.location.reload();   		
	    	}else{
	    		layer.msg(obj.msg);
	    	}
      	});
      	return false;
      });        
	});		
</script>
</html>
